#ifndef SENDTEXT_H
#define SENDTEXT_H

#include <QObject>
#include "netheader.h"
#include <QQueue>
#include <QMutex>

struct M{
    QString str;
    MSG_TYPE type;

    M(QString s, MSG_TYPE e){
        str = s;
        type =e;
    }
};

class SendText : public QObject
{
    Q_OBJECT
public:
    explicit SendText(QObject *parent = nullptr);
    ~SendText();
signals:

private:
    QQueue<M> textqueue;
    QMutex textqueue_lock;
    QWaitCondition queue_waitCond;  
    QMutex m_lock;
    bool m_isCanRun;

public slots:
    void push_Text(MSG_TYPE, QString str = "");
    void stopImmediately();
    void run();
};

#endif // SENDTEXT_H
